# -- coding: utf-8 --

from PythonBasicTest.command import Command

class CatCommand(Command):
    def __init__(self,args):
        Command.__init__(self,args)

    def usage(self):
        print("catfile     - printfile")

    def execute(self):
        if len(self.args) != 2:
            self.usage()
            return
        path = self.args[1]
        try:
            file = open(path)
            for i in file:
                print(i,end='')
        except IOError as e:
            print(e)
        finally:
            file.close()
